import Vue from 'vue'
import VueRouter from 'vue-router'

// 导入组件
import index from '../components/index'
import login from '../components/login'
import register from '../components/register'
import form from '../components/form'
import article from '../components/article'


Vue.use(VueRouter);

// 这是路由表的配置
// 为不同的路劲配置请求路劲
const routers = [
    { path: '/', redirect: '/index' },
    { path: '/index', component: index },
    { path: '/login', component: login },
    { path: '/register', component: register },
    { path: '/form', component: form },
    { path: '/create', component: form },
    { path: '/update/:aid', component: form, props: true },
    { path: '/article/:aid', component: article, props: true }
];
// 路由对象
export default new VueRouter({
    // mode: 'history ', //去掉urL中的# 
    routes: routers
})
